import request from "./request.js"

export const addEvent = (form) => {
    return request({
        url: '/api/event/add',
        method: 'post',
        data:{
            userId: form.userId,
            date: form.date,
            type: form.type,
            tag: form.tag,
            value: form.value,
            status: form.status,
            content: form.content,
        },
        headers: {
            'Content-Type': 'application/json'
          },
    })
}

export const deleteEvent = (id) => {
    return request({
        url: `/api/event/delete/${id}`,
        method: 'delete',
    })
}

export const completeEvent = (id) => {
    return request({
        url: `/api/event/complete/${id}`,
        method: 'post',
    })
}

export const getEventList = (userId) => {
    return request({
        url: '/api/event/list',
        method: 'get',
        params: {
          userId: userId
        }
    })
}

export const getAllEvent = () => {
    return request({
        url: '/api/event/list-all',
        method: 'get',
    })
}